﻿using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace ZenSystemService.Api.Migrations
{
    /// <inheritdoc />
    public partial class CourseTrainingItem2TrainingItem : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_TraineeCourseTraining_CourseTrainingItems_CourseTrainingItem~",
                table: "TraineeCourseTrainings");

            migrationBuilder.RenameColumn(
                name: "CourseTrainingItemId",
                table: "TraineeCourseTrainings",
                newName: "TrainingItemId");

            migrationBuilder.RenameIndex(
                name: "IX_TraineeCourseTraining_CourseTrainingItemId",
                table: "TraineeCourseTrainings",
                newName: "IX_TraineeCourseTrainings_TrainingItemId");

            migrationBuilder.AddForeignKey(
                name: "FK_TraineeCourseTrainings_TrainingItems_TrainingItemId",
                table: "TraineeCourseTrainings",
                column: "TrainingItemId",
                principalTable: "TrainingItems",
                principalColumn: "TrainingItemId",
                onDelete: ReferentialAction.Cascade);
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_TraineeCourseTrainings_TrainingItems_TrainingItemId",
                table: "TraineeCourseTrainings");

            migrationBuilder.RenameColumn(
                name: "TrainingItemId",
                table: "TraineeCourseTrainings",
                newName: "CourseTrainingItemId");

            migrationBuilder.RenameIndex(
                name: "IX_TraineeCourseTrainings_TrainingItemId",
                table: "TraineeCourseTrainings",
                newName: "IX_TraineeCourseTrainings_CourseTrainingItemId");

            migrationBuilder.AddForeignKey(
                name: "FK_TraineeCourseTrainings_CourseTrainingItems_CourseTrainingIte~",
                table: "TraineeCourseTrainings",
                column: "CourseTrainingItemId",
                principalTable: "CourseTrainingItems",
                principalColumn: "CourseTrainingItemId",
                onDelete: ReferentialAction.Cascade);
        }
    }
}
